﻿using FluentValidation;
using Sgr.UPMS.Application.Commands.Organizations;

namespace Sgr.UPMS.Application.Validations.Organizations
{
    /// <summary>
    /// 验证 CreateOrgInvitationCommand 的规则
    /// </summary>
    public class CreateOrgInvitationCommandValidator : AbstractValidator<CreateOrgInvitationCommand>
    {
        public CreateOrgInvitationCommandValidator()
        {
            RuleFor(x => x.ValidHours)
                .GreaterThan(0)
                .WithMessage("有效期（小时）必须大于0");

            RuleFor(x => x.UsageLimit)
                .Must(x => x == -1 || x > 0)
                .WithMessage("使用次数限制必须为-1（无限制）或大于0");

            RuleFor(x => x.Description)
                .MaximumLength(200)
                .WithMessage("描述信息不能超过200个字符");
        }
    }
}